using System;
using System.Collections.Generic;
using System.Threading;
using System.Windows.Forms;
using Preparation;
using Tester.Forms;

namespace Tester.GuiActions.Actions.Impl
{
    public class ExecuteStepByStepAction : BaseAction
    {
        public override bool Visible
        {
            get
            {
                return
                      TesterMultyDocument.Instance != null &&
                      TesterMultyDocument.Instance.Suspended == TesterMultyDocument.SuspendStates.Stopped &&
                      TesterList.Instance != null &&
                      TesterList.Instance.SelectedItems.Count == 1 &&
                      TesterMainForm.Instance.TopControl == EmbededControlTags.TesterList;
            }
        }

        public override void MainAction(object sender, EventArgs e)
        {
            if (Visible)
            {
                SpetByStepPreparation prepForm = new SpetByStepPreparation();
                prepForm.Test = (Test) TesterList.Instance.SelectedItems[0].Tag;
                prepForm.ShowDialog();
            }
        }
    }
}
